<div class="test_wrapper">
    <div class="test_header">
        <div class="test_header_left">
            Our Clients’ Testimonials
        </div>
        <?php if(isset($_SESSION['identity'])) : ?>
            <div class="test_add_new">
                <span class="add_testimonials"></span>
            </div>
        <?php endif; ?>
    </div>
    <div class="hidden_testimonials_block">
<!--        --><?//=isset($form)?$form:''?>
        <form id="testimonial" class="autoform" method="post" action="">

            <div class="hid_test_right">
                <textarea id="testimonial-text1" name="testimonial[text1]" type="checkbox" placeholder="Are you pleased with our services?"></textarea>
            </div>
            <div class="hid_test_left">
                <select id="testimonial-note1" name="testimonial[note1]">
                    <option selected="selected">Add your point</option>
                    <option value="1">1 point</option>
                    <option value="2">2 points</option>
                    <option value="3">3 points</option>
                    <option value="4">4 points</option>
                    <option value="5">5 points</option>
                </select>
            </div>
            <div class="clear"></div>
            <div class="hid_test_submit">
                <input id="testimonial-submit" type="submit" value="Publish" name="testimonial[submit]">
            </div>
        </form>
    </div>

    <?
    if(isset($testimonials)){
    foreach($testimonials as  $testimonial){

//        $width = $testimonial['note1'] * 14;

        echo'    <div class="test_item">
        <div class="test_item_left">
            <div class="test_item_author">'.$testimonial['name'].'</div>
            <div class="test_item_rating">Rating
                <span class="rating_background"></span>
                <span class="rating_overlay" style="width:'.(int)$testimonial['note1'] * 16 .'px"></span>
            </div>
        </div>

        <div class="test_item_right">
            <div class="test_item_text">
            '.$testimonial['text1'].'
            </div>
        </div>
    </div>';
    }}
    ?>

</div>
<div style="text-align: center;display: none;" id="upBlock"><img src="/images/loader.gif" alt=""/></div>

<script type="text/javascript">
    $('.add_testimonials').live('click',function(){
        var block = $(".hidden_testimonials_block");
        if($(".hidden_testimonials_block").is(':visible')){
            block.slideUp(1000);
            $(this).removeClass('add_testimonials_hide');
        }
        else{
           block.slideDown(1000);
           $(this).addClass('add_testimonials_hide');
        }
    });

    $('#testimonial-submit').bind('click',function(e){

        var textar = $('#testimonial-text1'),
            sel = $('#testimonial-note1 option:selected').val();
        if(textar.val() === '' || !parseInt(sel)){
            e.preventDefault();
//            textar.css('border','1px solid red');
            alert('Information is not full!');
        }

    });

    //cusel firing

//    jQuery(document).ready(function(){
//        var params = {
//            changedEl: "select",
//            visRows: 6,
//            scrollArrows: false
//        }
//        cuSel(params);
//    });

</script>

<script type="text/javascript">

    autoScroll("index/",$('.test_wrapper'),$('#upBlock'));

</script>

